Fix --showConfig to work when no input files are found#62047
Fix --showConfig to work when no input files are found#62047
Conversation
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Formatting has been run successfully with |
RyanCavanaugh
left a comment
There was a problem hiding this comment.
Instead of filtering, we can just do this in the other order. Write the output then issue diagnostics and exit.
Run npx hereby format again once you're doing with your changes
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
I've refactored the implementation to write the output first, then issue diagnostics as suggested. This is cleaner than filtering specific error codes. The config is now always shown when --showConfig is used, and all diagnostics are still properly reported afterward. Formatting has been applied. See commit f1c7d72. |
RyanCavanaugh
left a comment
There was a problem hiding this comment.
Run npx hereby runtest-parallel, WAIT FOR IT TO FINISH (20 minutes or more?), and submit the new baselines
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
I've run |
Summary
The
--showConfigflag was incorrectly failing when no input files matched the include patterns, even though its purpose is to display the parsed configuration without compilation. This change allows--showConfigto work properly regardless of whether input files are present.Problem
Previously, running
tsc --showConfigwith a configuration like:{"include": ["./*"]}...in an empty directory would fail with:
Solution
Modified
executeCommandLine.tsto filter out "No inputs were found" errors (TS18003) when the--showConfigflag is used, since the purpose is to show configuration, not to compile files.Behavior
Before:
After:
Other errors (like invalid compiler options) are still properly reported when using
--showConfig.Testing
Fixes #48443.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.